<?php

class Veneer_Cache
{
	protected $cache;
	protected $pgId;

	function __construct( $cache_life=86400)
	{
		$frontendOptions = array(
		   'lifetime' => $cache_life, // cache lifetime of 1 day
		   'automatic_serialization' => false
		);

		$backendOptions = array(
		    'cache_dir' => CACHE_PATH . 'cache'		// Directory where to put the cache files
		);
		// getting a Zend_Cache_Core object
		$this->cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
//		$this->cache->save("test","test");

	}
	public function pgSave( $stuff, $path="")
	{	// add tags for module
		$this->pgId = "pg".sha1($_SERVER['REQUEST_URI']);
		$this->cache->save($stuff, $this->pgId);
	}
	public function pgLoad()
	{
		$this->pgId = "pg".sha1($_SERVER['REQUEST_URI']);
		return $this->cache->load( $this->pgId);
	}
	public function pgClean()
	{
		$cache->clean(Zend_Cache::CLEANING_MODE_OLD);
	}
	public function pgClear()
	{
		$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
	}

}